<template>
  <el-drawer
    v-model="planOrder.isDrawerShow"
    :show-close="false"
    :before-close="handleClose"
    size="70%"
  >
    <template #header="{ close, titleId, titleClass }"> </template>
    <!-- <Process /> -->
    <Order />
  </el-drawer>
</template>

<script lang="ts" setup>
import {
  ref,
  reactive,
  onMounted,
  inject,
  onBeforeUnmount,
  provide,
} from "vue";
import { ElButton, ElDrawer } from "element-plus";
import { useRouter } from "vue-router";
import { BaiduMap, BmMarker } from "vue-baidu-map-3x"; //baidu-map组件red
import useCurrentInstance from "@/utils/useCurrentInstance";
import { useDashboard } from "@/store/backend/dashboard";
import { useBackendMonitor } from "@/store/backend/EquipM/monitor"; //实时设备监控仓库
import { useAccess } from "@/store/backend/DeviceM/access";
import { useBusiness } from "@/store/backend/BusinessM/info";
import { useBigBoardB } from "@/store/backend/BigBoard/bigBoard2";
import { useRegion } from "@/store/backend/SysM/region";
import Process from "../../planManager/components/processes.vue";
import Order from "../workorderTable.vue";
import { useDictionary } from "@/store/backend/tool/dictionary";
import { useProductionWorkOrder } from "@/store/backend/ProductionPlan/workOrder";

const { proxy } = useCurrentInstance(); //全局事件总线
const dashboard = useDashboard();
const router = useRouter();
const monitor = useBackendMonitor();
const access = useAccess();
const bb = useBigBoardB();
const region = useRegion();
const planOrder = useProductionWorkOrder();
const dictionary = useDictionary();

interface Props {
  modelValue: boolean;
  info: any;
}
interface Info {
  addr: string;
  code: string;
  id: number;
  lat: number;
  lng: number;
  name: string;
  productName: string;
  remark: null | null;
  state: number;
  location: any;
}
const props = withDefaults(defineProps<Props>(), {
  modelValue: false,
  info: () => {
    return {};
  },
});

const emits = defineEmits<{
  (e: "update:modelValue", value: boolean): void;
}>();

const state: { info: any; rows: any[] } = reactive({
  info: {
    addr: "",
    code: "",
    id: 0,
    lat: 0,
    lng: 0,
    name: "",
    productName: "",
    remark: "",
    state: 0,
    location: {},
  },
  rows: [],
});
const handleClose = (done: () => void) => {
  done();
  emits("update:modelValue", false);
  console.log("触发");
  planOrder.isDrawerShow = false;
  state.info = {
    addr: "",
    code: "",
    id: 0,
    lat: 0,
    lng: 0,
    name: "",
    productName: "",
    remark: "",
    state: 0,
    location: {},
  };
};

onMounted(() => {});
onBeforeUnmount(() => {
  proxy.eventBus.off("DevicesInfo");
});

provide("dictionary", dictionary);
</script>

<style lang="scss" scoped>
.devicesMap {
  .map {
    left: 0px;
    top: 0px;
    z-index: 9;
    overflow: hidden;
    width: 100%;
    height: 200px;
  }
}
.header {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
</style>
